package com.demo.controller.setting;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.demo.dao.Result;
import com.demo.service.setting.ProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.demo.pojo.setting.Process;

@RestController
@RequestMapping("/processSet/processType")
public class ProcessController {
    @Autowired
    private ProcessService processService;

    @PostMapping
    public Result addProcess(@RequestBody Process process) {
        processService.save(process);
        return Result.success();
    }

    @DeleteMapping
    public Result deleteProcess(@RequestParam int id) {
        processService.removeById(id);
        return Result.success();
    }

    @PutMapping
    public Result updateProcess(@RequestBody Process process) {
        processService.updateById(process);
        return Result.success();
    }
    @GetMapping
    public Result<Page<Process>> getProcess(int pageNum, int pageSize) {

        Page<Process> page = processService.lambdaQuery().page(Page.of(pageNum, pageSize));
        return Result.success(page);
    }
}
